package stu.sup.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import stu.sup.entity.ClassTable;
import stu.sup.entity.Product;
import stu.sup.mapper.ClassTableMapper;
import stu.sup.mapper.ProductMapper;
import stu.sup.service.IClassTableService;

import java.util.Date;

/**
 * Created by HUAWEI on 2020/6/23.
 */
@Service
@Transactional
public class ClassTableServiceImpl implements IClassTableService{
    @Autowired
    ClassTableMapper classTableMapper;
    @Autowired
    ProductMapper productMapper;
    @Override
    public Product selectbyBrand(String brand) {
        int id=classTableMapper.selectbyBrand(brand);
        Product product=productMapper.selectByPrimaryKey(id);
        return product;
    }

    @Override
    public Product selectbyPlace(String place) {
        int id=classTableMapper.selectbyPlace(place);
        Product product=productMapper.selectByPrimaryKey(id);
        return product;
    }

    @Override
    public Product selectByTime(Date time) {
        int id=classTableMapper.selectByTime(time);
        Product product=productMapper.selectByPrimaryKey(id);
        return product;
    }

    @Override
    public Product selectByweigt(String weigt) {
        int id=classTableMapper.selectByweigt(weigt);
        Product product=productMapper.selectByPrimaryKey(id);
        return product;
    }

    @Override
    public Product selectByway(String way) {
        int id=classTableMapper.selectByway(way);
        Product product=productMapper.selectByPrimaryKey(id);
        return product;
    }

    @Override
    public Integer add(ClassTable classTable) {
        int count=classTableMapper.insert(classTable);
        return count;
    }
}
